package com.buka.web;


import com.buka.service.Service;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class Controller {

    @Resource
    RabbitTemplate rabbitTemplate;

    @Resource
    Service service;

    @RequestMapping("/start")
    public String start(String uid) {
        //body传参，传递json对象，请求头是 application/json  请求体
        //form 传参，请求头是 application/x-www-form-urlencoded  请求体
        service.start(uid);
        return "start";
    }

    @RequestMapping("/stop")
    public String stop(String uid) throws InterruptedException {
        //body传参，传递json对象，请求头是 application/json  请求体
        //form 传参，请求头是 application/x-www-form-urlencoded  请求体

        return service.stop(uid);
    }

}
